<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>Article</title>
	</head>
	<body>
		<div id="app">
			<input type="button" name="Write" value="Write" @click="loadWrite()"/>
			<table class="table table-hover">
				<thead>
					<tr>
						<th>Title</th>
						<th>Class</th>
						<th>Time</th>
					</tr>
				</thead>
				<tbody v-for="(item, index) in title">
					<tr>
						<td><a href="{{ url[index] }}">item</a></td>
						<td>{{ _class[index] }}</td>
						<td>{{ time[index] }}</td>
					</tr>
				</tbody>
			</table>	
		</div>
		<script src="https://cdn.jsdelivr.net/npm/vue"></script>
		<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
		<script type="text/javascript">
			var app = new Vue({
				el: '#app',
				data: {
					title: [],
					url: [],
					_class: [],
					time: [],
					mounted: function () {
						this.getInfo();
					}
				},
				methods: {
					getInfo: function () {
						that = this
						axios.get('/information')
						  .then(function (res) {
						    that.title = res.title
							that.url = res.url
							that._class = res._class
							that.time = res.time
						  })
						  .catch(function (error) {
						    console.log(error);
						  });
					},
					loadWrite: function () {
						window.location.href = '/write';
					}
				}
				
			})
		</script>
	</body>
</html>